#include <iostream>
#include <iterator>
#include <algorithm>
#include <vector>
#include <fstream>
#include <string>
using namespace std;

int main()
{
    string from, to;
    cin >> from >> to;

    ifstream in{from};
    ofstream out{to};

    istream_iterator<string> ii{in};
    istream_iterator<string> eos{};
    ostream_iterator<string> oo{out, "\n"};

    vector<string> v(ii, eos);
    sort(v.begin(), v.end());
    // copy(v.begin(), v.end(), oo);
    unique_copy(v.begin(), v.end(), oo);

    in.close();
    out.close();
    return 0;
}